home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / Papers / aSEPiA example source / Application / source / CTextView.cp < prev    next >
Encoding:
Text File  |  1999-06-25  |  1.8 KB  |  78 lines  |  [TEXT/CWIE]

  1. // =================================================================================
  2. //    CTextView.cp                    ©1996-1998 Metrowerks Inc. All rights reserved.
  3. // =================================================================================
  4.  
  5. #include <LStream.h>
  6.  
  7. #include "CTextView.h"
  8.  
  9.  
  10. // ---------------------------------------------------------------------------------
  11. //        • CTextView(LStream*)
  12. // ---------------------------------------------------------------------------------
  13.  
  14. CTextView::CTextView(
  15.     PP_PowerPlant::LStream    *inStream )
  16.         : LTextEditView( inStream )
  17. {
  18.     mIsDirty = false;
  19. }
  20.  
  21.  
  22. CTextView::~CTextView()
  23. {
  24. }
  25.  
  26. // ---------------------------------------------------------------------------------
  27. //        • UserChangedText
  28. // ---------------------------------------------------------------------------------
  29.  
  30. void
  31. CTextView::UserChangedText()
  32. {
  33.     if ( !IsDirty() ) {
  34.  
  35.         // Set the update menus flag.
  36.         SetUpdateCommandStatus( true );
  37.         
  38.         // Set the dirty flag.
  39.         SetDirty( true );
  40.  
  41.     }
  42. }
  43.  
  44.  
  45. // ---------------------------------------------------------------------------------
  46. //        • SavePlace
  47. // ---------------------------------------------------------------------------------
  48.  
  49. void
  50. CTextView::SavePlace(
  51.     PP_PowerPlant::LStream    *outPlace )
  52. {
  53.     // Call inherited.
  54.     LTextEditView::SavePlace( outPlace );
  55.     
  56.     // Save the image size.
  57.     outPlace->WriteData( &mImageSize, sizeof(PP_PowerPlant::SDimension32) );
  58. }
  59.  
  60.  
  61. // ---------------------------------------------------------------------------------
  62. //        • RestorePlace
  63. // ---------------------------------------------------------------------------------
  64.  
  65. void
  66. CTextView::RestorePlace(
  67.     PP_PowerPlant::LStream    *inPlace )
  68. {
  69.     // Call inherited.
  70.     LTextEditView::RestorePlace( inPlace );
  71.     
  72.     // Restore the image size.
  73.     inPlace->ReadData( &mImageSize, sizeof(PP_PowerPlant::SDimension32) );
  74.     
  75.     // Realign the text edit rects.
  76.     AlignTextEditRects();
  77. }
  78.